<template>
  <div>
    控件中心

    <TreeStructure
      ref="treeStructure"
      :data="treeData"
      :tree-highlight-current="true"
      :default-props="defaultProps"
      :btn-list="btnList"
      @menuOperate="menuOperateFunc"
    />
  </div>
</template>
<script>
import TreeStructure from './dt-tree/src/index.vue'

export default {
  name: 'WidgetCenter',
  components: { TreeStructure },
  data() {
    return {
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      btnList: [
        {
          name: '编辑按钮',
          icon: 'el-icon-edit',
          label: '',
          value: 'edit',
          id: '1',
          listener: (a, b) => {
            this.editFunc(a, b)
          }
        },
        {
          name: '新增按钮',
          icon: 'el-icon-circle-plus-outline',
          label: '',
          value: 'add',
          id: '2',
          listener: () => {
            this.addFunc()
          }
        },
        {
          name: '删除按钮',
          icon: 'el-icon-delete',
          label: '',
          value: 'delete',
          id: '3',
          listener: () => {
            this.deleteFunc()
          }
        }
      ],
      treeData: [
        {
          id: '1',
          label: '部门',
          code: '100001',
          children: [
            {
              id: '11',
              label: '管事会',
              code: '1000011',
              children: [
                {
                  id: '1',
                  label: '部门',
                  code: '100001',
                  hiddenMenu: true,
                  children: [
                    {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }
                  ]
                }, {
                  id: '1',
                  label: '部门',
                  code: '100001',
                  children: [
                    {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }
                  ]
                }, {
                  id: '1',
                  label: '部门',
                  code: '100001',
                  children: [
                    {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }
                  ]
                }
              ]
            }
          ]
        }, {
          id: '1',
          label: '部门',
          code: '100001',
          children: [
            {
              id: '11',
              label: '管事会',
              code: '1000011',
              children: [

              ]
            }
          ]
        }, {
          id: '1',
          label: '部门',
          code: '100001',
          children: [
            {
              id: '11',
              label: '管事会',
              code: '1000011',
              children: [
                {
                  id: '1',
                  label: '部门',
                  code: '100001',
                  children: [
                    {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }
                  ]
                }, {
                  id: '1',
                  label: '部门',
                  code: '100001',
                  children: [
                    {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }
                  ]
                }, {
                  id: '1',
                  label: '部门',
                  code: '100001',
                  children: [
                    {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }, {
                      id: '11',
                      label: '管事会',
                      code: '1000011'
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  },
  methods: {
    editFunc(data, a) {
      alert('editFunc')
    },
    deleteFunc(data) {
      alert('deleteFunc')
    },
    addFunc(data) {
      alert('addFunc')
    },
    menuOperateFunc(val) {
    }
  }
}
</script>

